package Homework5;

import java.util.*;

public class Household {
    private boolean on = false;
    private String brand;
    private Date productDate;

    public Household(){
    }

    public Household(String brand, Date productDate){
        this.brand = brand;
        this.productDate = productDate;
    }

    public boolean isOn() {
        return on;
    }

    public void setOn(boolean on) {
        this.on = on;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public Date getProductDate() {
        return productDate;
    }

    public void setProductDate(Date productDate) {
        this.productDate = productDate;
    }

    public String getProductDateString() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(productDate);
        return calendar.get(Calendar.YEAR) + "-" +
                (calendar.get(Calendar.MONTH) + 1) + "-" +
                        calendar.get(Calendar.DAY_OF_MONTH);
    }

    @Override
    public String toString() {
        return "Household: brand = " + brand +
                " productDate = " + getProductDateString();
    }
}
